﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Reflection;
using System.IO;
using System.Xml;
using IniFileManager;


namespace AppUsingLibrary
{
	class Program
	{
		static void Main( string[] args )
		{
            Assembly assembly = Assembly.GetExecutingAssembly();
            Stream IniSchema1XmlStream = assembly.GetManifestResourceStream("AppUsingLibrary.example01.xml");
            IniSchema iniSchema1 = new IniSchema(IniSchema1XmlStream);

            Stream IniSchema2XmlStream = assembly.GetManifestResourceStream("AppUsingLibrary.example02.xml");
            IniSchema iniSchema2 = new IniSchema(IniSchema2XmlStream);

            Stream IniSchema3XmlStream = assembly.GetManifestResourceStream("AppUsingLibrary.example03.xml");
            IniSchema iniSchema3 = new IniSchema(IniSchema3XmlStream);




			// Peter:
			Console.WriteLine( "Parsing started" );
			IniData configuration = IniParser.LoadIni( new System.IO.FileStream( "example02.ini", System.IO.FileMode.Open ), IniLoadOptions.DefaultValues, iniSchema2 );
			Console.WriteLine( "Parsing done" );

			///////////////
			// ZMENA DAT //
			///////////////
			//configuration.Sections["Sekce 1"].Properties["Option 1"].AddElement(new IniStringElement("muj novy element"));

			Console.WriteLine(configuration.Sections["general"].Properties["dns"].Elements[0].Value);
			Console.WriteLine( "Saving File:" );
			IniParser.SaveIniToTextWriter( configuration, Console.Out );
			Console.WriteLine( "End of saving File:" );



			
			Console.ReadLine();
			// Termination:
			//Console.ReadLine();
		}
	}
}
